<%@page import="org.apache.commons.lang.StringUtils"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@page import="com.wowangz.cms.syscore.utils.MessageResourcesUtils" %>
<%@ page import="com.wowangz.cms.syscore.api.UserContext"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String errorMessage = "";
	if(session.getAttribute("errorMessage") != null){
		errorMessage = session.getAttribute("errorMessage").toString();
		session.setAttribute("errorMessage", null);
	}
%>
<c:set var="systemctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="Cache-Control" content="no-store"/>
	<meta http-equiv="Pragma" content="no-cache"/>
	<meta http-equiv="Expires" content="0"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
	<meta name="renderer" content="webkit"/>
	<title>CMS管理系统-登录</title>
	<link rel="stylesheet" type="text/css"  href="${systemctx }/resources/css/base.css" />
	<link rel="stylesheet" type="text/css"  href="${systemctx }/resources/css/login.css" />
	<script type="text/javascript" src="${systemctx}/resources/js/jquery-1.9.1.min.js"></script>
</head>
<body>
<form name="form" id="form" action="${systemctx }/user/login.web" method="post">

<!--login start-->
<div class="bg-login">
<div class="bg-login-wrap">
	<div class="login-wrap">
		<div class="logo"></div>
		<!--登录框-->
		<div class="login">
			<div class="login-box">
				<dl>
					<dt><i class="ico-language"></i></dt>
					<dd>
						<select class="txt-login" id="language" name="language" placeholder="常用语言" >
			  				<option value="zh_CN">中文</option>
					  		<option value="en_US">English</option>
			  			</select>
					</dd>
				</dl>
				<dl>
					<dt><i class="ico-user"></i></dt>
					<dd>
						<input class="txt-login" placeholder="<%=MessageResourcesUtils.getMessage(request,"common.login.jsp.username") %>" type="text" id="loginname" name="loginname" value="${userInfo.loginname}" >
					</dd>
				</dl>
				<dl>
					<dt><i class="ico-pass"></i></dt>
					<dd>
						<input class="txt-login" placeholder="<%=MessageResourcesUtils.getMessage(request,"common.login.jsp.password") %>" type="password" id="password" name="password" value="${userInfo.password}">
					</dd>
				</dl>
<!-- 				<dl> -->
<!-- 					<dt><i class="ico-code"></i></dt> -->
<!-- 					<dd> -->
<%-- 						<input class="txt-login txt-code" placeholder="<%=MessageResourcesUtils.getMessage(request, "systemmanage.regex.code.column")%>"  type="text" name="vCode" id="vCode" onkeypress="enterLogin(event);"> --%>
<%-- 						<img class="code-pic" title="<%=MessageResourcesUtils.getMessage(request,"common.login.jsp.clickchange") %>" id="refush" onclick="initCode()" src=""> --%>
<!-- 					</dd> -->
<!-- 				</dl> -->
				<div class="btn-box">
					<input class="btn-login" type="button" value="<%=MessageResourcesUtils.getMessage(request,"common.login.jsp.login") %>" onclick="toSubmit()">
				</div>
				<div class="login-tips"><span id="remind"> </span></div>
			</div>	
	 	</div>
	</div>
	<div class="login-footer-wrap">
		<div class="bg-cloud"></div>
		<div class="login-footer">
			Copyright © 2015 - 2016 Corporation, All Rights Reserved   语联网（武汉）信息技术有限公司   版权所有
		</div>
	</div>
</div>
</div>
<!--login end-->	

</form>
<script type="text/javascript">
	function initCode(){
		var date = new Date().getTime();
		$("#refush").attr("src",'${systemctx}/validateCodeServlet.images?time='+date);
	}
	$(document).ready(function(){
		initCode();
		var errorMessage = '<%=errorMessage%>';
		if(errorMessage!=""){
			alert(errorMessage);
		}
	});

	function toSubmit(){
		var loginName = $("#loginname");
		var password = $("#password");
		if(loginName.value==""){
			alert("<%=MessageResourcesUtils.getMessage(request,"alertinfo.user.jsp.alert1") %>");
			return false;
		}
		if(password.value==""){
			alert("<%=MessageResourcesUtils.getMessage(request,"alertinfo.user.jsp.alert2") %>");
			return false;
		}
// 		var vCode = $("#vCode").val();
// 		if(vCode ==''){
<%-- 			alert('<%=MessageResourcesUtils.getMessage(request, "systemmanage.regex.code.info")%>'); --%>
// 			return;
// 		}else if(vCode != '' && vCode != undefined){
// 			vCode = vCode.toLowerCase();
// 			$.get('${systemctx}/getCodeServlet.json?validateCode='+vCode,function(data){
// 				if(data =="error"){
<%-- 					alert('<%=MessageResourcesUtils.getMessage(request, "systemmanage.regex.code.error")%>'); --%>
// 					var date = new Date().getTime();
// 					$("#vCode").val('');
// 					initCode();
// 					return;
// 				}else {
					document.form.submit();
// 				}
// 			});
// 		}
		
	}
	
	function enterLogin(event){
	 var evt=window.event?window.event:event;
	 var IEexplorer = navigator.appVersion.match(/MSIE/) == "MSIE";
	 var code="";
	    if(IEexplorer){
	    code=evt.keyCode;
	    }
	    else{
	    code=evt.which;
	    }
	    if(code=="13"){
	    	toSubmit();
	    }
	    else{
	    return false;
	    }
	};
	
	$.fn.ajaxmessage = function (data) {

		//消息为INFO时处理逻辑
		if(data.messagetype == '<%=UserContext.MessageType.INFO%>'){
			//$.messager.alert('信息提示', data.message, 'info');
			alert(data.message);
		}
		//消息为ERROR时处理逻辑
		if(data.messagetype == '<%=UserContext.MessageType.ERROR%>'){
			//$.messager.alert('信息提示', data.message, 'error');
			alert(data.message);
		}
	};

</script>
</body></html>